namespace YMJake.Flowable.ExternalWorker.Client.Core.Client;

/// <summary>
/// Implementation of an acquired external worker job
/// </summary>
public class AcquiredExternalWorkerJob : IAcquiredExternalWorkerJob
{
    public string Id { get; }
    public string? CorrelationId { get; }
    public int Retries { get; }
    public DateTime? DueDate { get; }
    public string? ExceptionMessage { get; }
    public string? TenantId { get; }
    public string? ElementId { get; }
    public string? ElementName { get; }
    public string? ScopeId { get; }
    public string? SubScopeId { get; }
    public string? ScopeType { get; }
    public string? ScopeDefinitionId { get; }
    public DateTime? CreateTime { get; }
    public string? WorkerId { get; }
    public DateTime? LockExpirationTime { get; }
    public Dictionary<string, object?> Variables { get; }

    public AcquiredExternalWorkerJob(
        string id,
        string? correlationId,
        int retries,
        DateTime? dueDate,
        string? exceptionMessage,
        string? tenantId,
        string? elementId,
        string? elementName,
        string? scopeId,
        string? subScopeId,
        string? scopeType,
        string? scopeDefinitionId,
        DateTime? createTime,
        string? workerId,
        DateTime? lockExpirationTime,
        Dictionary<string, object?> variables)
    {
        Id = id;
        CorrelationId = correlationId;
        Retries = retries;
        DueDate = dueDate;
        ExceptionMessage = exceptionMessage;
        TenantId = tenantId;
        ElementId = elementId;
        ElementName = elementName;
        ScopeId = scopeId;
        SubScopeId = subScopeId;
        ScopeType = scopeType;
        ScopeDefinitionId = scopeDefinitionId;
        CreateTime = createTime;
        WorkerId = workerId;
        LockExpirationTime = lockExpirationTime;
        Variables = variables;
    }

    public override string ToString()
    {
        return $"{nameof(Id)}: {Id}";
    }
}